package com.example.doer.reading;


import android.os.Bundle;
import android.widget.ListView;
import android.widget.TextView;

import com.ab.activity.AbActivity;

public class TopicWithReplyActivity extends AbActivity {
    private TextView topicName;
    private TextView topicContent;
    private ListView replyListView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setAbContentView(R.layout.activity_topic_with_reply);
        topicName = (TextView)findViewById(R.id.nameOfActivityTopicWithReply);
        topicContent = (TextView)findViewById(R.id.contentOfActivityTopicWithReply);
        replyListView = (ListView)findViewById(R.id.topicReplyListView);

        //获取传递的数据
        final Topic receivedTopic = (Topic) getIntent().getSerializableExtra("topicObjWithReply");

        topicName.setText(receivedTopic.getTopicName());
        topicContent.setText(receivedTopic.getTopicContent());

        //获取listView的对象引用
        ListView listView = (ListView) findViewById(R.id.topicReplyListView);

        TopicReplyListAdapter topicReplyListAdapter = new TopicReplyListAdapter(TopicWithReplyActivity.this,receivedTopic.getTopicReply(),R.layout.topic_reply_listview);

        listView.setEmptyView(findViewById(R.id.topicReplyListView_emptyView));

        if(receivedTopic.getTopicReply().size()!=0)
            listView.setAdapter(topicReplyListAdapter);
//        else listView.setEmptyView(findViewById(R.id.topicReplyListView_emptyView));



    }//end onCreate method
}//end class
